import { createSSRApp } from 'vue'
import * as Pinia from 'pinia'
import '@/utils/http'
import '@/utils/chat'

import App from './App.vue'
import uviewPlus from '@/uni_modules/uview-plus'
import persist from 'pinia-plugin-persistedstate'
import util from './utils/util'
// #ifdef APP-PLUS
plus.nativeUI.toast = function (str, value) {
  if (str == '再按一次退出应用') {
    return false
  }
}
// #endif
export function createApp() {
  const pinia = Pinia.createPinia()
  const app = createSSRApp(App)
  pinia.use(persist)
  app.use(pinia)
  app.use(uviewPlus)
  app.config.globalProperties.$util = util
  return {
    app,
    Pinia,
  }
}
